<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" th:value="${goodsLive.id}"  type="hidden">
							<!--<div class="form-group">
								<label class="col-sm-3 control-label">选择商品：</label>
								<div class="col-sm-8">
									<select data-placeholder="&#45;&#45;选择商品&#45;&#45;" name="goodsId" id="goodsId"
											class="form-control chosen-select" tabindex="2" >
										<option value="-1">&#45;&#45;选择商品&#45;&#45;</option>
										<option th:each="goods : ${goodsList}" th:value="${goods.id}" th:text="${goods.name}" th:if="${goodsLive.goodsId ==goods.id}" th:selected="selected"></option>
									</select>
								</div>
							</div>-->
							<!--<div class="form-group">
								<label class="col-sm-3 control-label">商品id：</label>
								<div class="col-sm-8">
									<input id="goodsId" name="goodsId" th:value="${goodsLive.goodsId}" class="form-control" type="text">
								</div>
							</div>-->

							<div class="form-group">
								<label class="col-sm-3 control-label">审核状态：</label>
								<div class="col-sm-8">
									<input type="text"  disabled="disabled" th:if="${wxMaShopGetSpuResult.editStatus}=='1'" value="未审核" class="form-control">
									<input type="text"  disabled="disabled" th:if="${wxMaShopGetSpuResult.editStatus}=='2'" value="审核中" class="form-control">
									<input type="text"  disabled="disabled" th:if="${wxMaShopGetSpuResult.editStatus}=='3'" value="审核失败"  class="form-control">
									<input type="text"  disabled="disabled" th:if="${wxMaShopGetSpuResult.editStatus}=='4'" value="审核成功"  class="form-control">
									<!--<input type="text"  disabled="disabled" th:if="${wxMaShopGetSpuResult.editStatus}=='0'" value="未审核" style="width:80%" class="layui-input">
									<input id="editStatus" name="editStatus" th:value="${wxMaShopGetSpuResult.editStatus}" class="form-control" type="text">-->
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">上架状态：</label>
								<div class="col-sm-8">
									<input type="text"  disabled="disabled" th:if="${wxMaShopGetSpuResult.status}=='0'" value="初始值" class="form-control">
									<input type="text"  disabled="disabled" th:if="${wxMaShopGetSpuResult.status}=='5'" value="上架" class="form-control">
									<input type="text"  disabled="disabled" th:if="${wxMaShopGetSpuResult.status}=='11'" value="自主下架"  class="form-control">
									<input type="text"  disabled="disabled" th:if="${wxMaShopGetSpuResult.status}=='13'" value="违规下架/风控系统下架"  class="form-control">

									<!--<input id="status" name="status" th:value="${wxMaShopGetSpuResult.status}" class="form-control" type="text">-->
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">失败原因：</label>
								<div class="col-sm-8">


									<input id="rejectReason" name="rejectReason" th:value="${wxMaShopGetSpuResult.auditInfo.rejectReason}"  class="form-control" type="text" disabled>
								</div>
							</div>
														<div class="form-group">	
								<label class="col-sm-3 control-label">创建时间：</label>
								<div class="col-sm-8">
									<input id="createTime" name="createTime" th:value="${wxMaShopGetSpuResult.createTime}" class="form-control" type="text" disabled>
								</div>
							</div>
														<div class="form-group">	
								<label class="col-sm-3 control-label">更新时间：</label>
								<div class="col-sm-8">
									<input id="updateTime" name="updateTime" th:value="${wxMaShopGetSpuResult.updateTime}" class="form-control" type="text" disabled>
								</div>
							</div><!--
														<div class="form-group">	
								<label class="col-sm-3 control-label">创建时间：</label>
								<div class="col-sm-8">
									<input id="caAt" name="caAt" th:value="${goodsLive.caAt}" class="form-control" type="text">
								</div>
							</div>
														<div class="form-group">	
								<label class="col-sm-3 control-label">修改时间：</label>
								<div class="col-sm-8">
									<input id="upAt" name="upAt" th:value="${goodsLive.upAt}" class="form-control" type="text">
								</div>
							</div>
														<div class="form-group">	
								<label class="col-sm-3 control-label">0默认1删除：</label>
								<div class="col-sm-8">
									<input id="delFlag" name="delFlag" th:value="${goodsLive.delFlag}" class="form-control" type="text">
								</div>
							</div>-->
																					<div class="form-group" th:if="${wxMaShopGetSpuResult.editStatus } eq 2">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">撤销审核</button>
								</div>
							</div>
							<div class="form-group" th:if="${wxMaShopGetSpuResult.status } eq 5 ">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="button" onclick="delistingGoods();" class="btn btn-primary">下架</button>
								</div>
							</div>

							<div class="form-group" th:if="${wxMaShopGetSpuResult.status } eq 11 or ${wxMaShopGetSpuResult.status } eq 13">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="button" onclick="listingGoods();" class="btn btn-primary">上架</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
	</div>
	</div>
	<div th:include="include::footer"></div>
	<script type="text/javascript" src="/css/plugins/laydate/laydate.js"></script>
	<script src="/js/bootstrap.min.js?v=3.3.6"></script>
	<script src="/js/layui.js"></script>
	<script type="text/javascript" src="/js/appjs/wx/goodsLive/edit.js">
	</script>
	<script  th:inline="javascript">

		$.validator.setDefaults({
			submitHandler : function() {
				delAudit();
			}
		});
		<!--撤销审核 -->
		function delAudit() {
			$.ajax({
				cache : true,
				type : "POST",
				url : "/wx/goodsLive/delAudit",
				data : $('#signupForm').serialize(),// 你的formid
				async : false,
				error : function(request) {
					parent.layer.alert("Connection error");
				},
				success : function(data) {
					if (data.code == 0) {
						parent.layer.msg("操作成功");
						parent.reLoad();
						var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
						parent.layer.close(index);

					} else {
						parent.layer.alert(data.msg)
					}

				}
			});

		}

		<!--商品上架 -->
		function listingGoods() {
			$.ajax({
				cache : true,
				type : "POST",
				url : "/wx/goodsLive/listingGoods",
				data : $('#signupForm').serialize(),// 你的formid
				async : false,
				error : function(request) {
					parent.layer.alert("Connection error");
				},
				success : function(data) {
					if (data.code == 0) {
						parent.layer.msg("操作成功");
						parent.reLoad();
						var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
						parent.layer.close(index);

					} else {
						parent.layer.alert(data.msg)
					}

				}
			});

		}
		<!--商品下架 -->
		function delistingGoods() {
			$.ajax({
				cache : true,
				type : "POST",
				url : "/wx/goodsLive/delistingGoods",
				data : $('#signupForm').serialize(),// 你的formid
				async : false,
				error : function(request) {
					parent.layer.alert("Connection error");
				},
				success : function(data) {
					if (data.code == 0) {
						parent.layer.msg("操作成功");
						parent.reLoad();
						var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
						parent.layer.close(index);

					} else {
						parent.layer.alert(data.msg)
					}

				}
			});

		}

	</script>
</body>
</html>
